package com.jxw.gk;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.IntentFilter;
import com.jxw.launcher.util.ReceiverUtil;

/* loaded from: classes.dex */
public class ControlAppReceiver extends BroadcastReceiver {
    private static Context mContext;
    private static ControlAppReceiver mReceiver;

    public static void init(Context context) {
        mContext = context.getApplicationContext();
        mReceiver = new ControlAppReceiver();
        IntentFilter intentFilter = new IntentFilter(ReceiverUtil.ACTION_CONNECTIVITY_ACTION);
        intentFilter.addAction("com.jxw.control_app");
        mContext.registerReceiver(mReceiver, intentFilter);
    }

    private ControlAppReceiver() {
    }

    /* JADX WARN: Code restructure failed: missing block: B:11:0x0048, code lost:
        com.jxw.gk.GkAppUseInfo.getGkAppUseInfo().datas.get(r4).setEnabled(r3.getEnabled());
     */
    @Override // android.content.BroadcastReceiver
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct code enable 'Show inconsistent code' option in preferences
    */
    public void onReceive(android.content.Context r3, android.content.Intent r4) {
        /*
            r2 = this;
            com.google.gson.Gson r3 = new com.google.gson.Gson     // Catch: java.lang.Exception -> L5f
            r3.<init>()     // Catch: java.lang.Exception -> L5f
            java.lang.String r0 = "appUseInfo"
            java.lang.String r4 = r4.getStringExtra(r0)     // Catch: java.lang.Exception -> L5f
            java.lang.Class<com.jxw.gk.AppUseInfo> r0 = com.jxw.gk.AppUseInfo.class
            java.lang.Object r3 = r3.fromJson(r4, r0)     // Catch: java.lang.Exception -> L5f
            com.jxw.gk.AppUseInfo r3 = (com.jxw.gk.AppUseInfo) r3     // Catch: java.lang.Exception -> L5f
            com.jxw.gk.GkAppUseInfo r4 = com.jxw.gk.GkAppUseInfo.getGkAppUseInfo()     // Catch: java.lang.Exception -> L5f
            java.util.List<com.jxw.gk.AppUseInfo> r4 = r4.datas     // Catch: java.lang.Exception -> L5f
            if (r4 == 0) goto L5f
            r4 = 0
        L1c:
            com.jxw.gk.GkAppUseInfo r0 = com.jxw.gk.GkAppUseInfo.getGkAppUseInfo()     // Catch: java.lang.Exception -> L5f
            java.util.List<com.jxw.gk.AppUseInfo> r0 = r0.datas     // Catch: java.lang.Exception -> L5f
            int r0 = r0.size()     // Catch: java.lang.Exception -> L5f
            if (r4 >= r0) goto L5f
            com.jxw.gk.GkAppUseInfo r0 = com.jxw.gk.GkAppUseInfo.getGkAppUseInfo()     // Catch: java.lang.Exception -> L5f
            java.util.List<com.jxw.gk.AppUseInfo> r0 = r0.datas     // Catch: java.lang.Exception -> L5f
            java.lang.Object r0 = r0.get(r4)     // Catch: java.lang.Exception -> L5f
            com.jxw.gk.AppUseInfo r0 = (com.jxw.gk.AppUseInfo) r0     // Catch: java.lang.Exception -> L5f
            java.lang.String r1 = r3.getPackageName()     // Catch: java.lang.Exception -> L5f
            if (r1 == 0) goto L5c
            java.lang.String r1 = r3.getPackageName()     // Catch: java.lang.Exception -> L5f
            java.lang.String r0 = r0.getPackageName()     // Catch: java.lang.Exception -> L5f
            boolean r0 = r1.equals(r0)     // Catch: java.lang.Exception -> L5f
            if (r0 == 0) goto L5c
            com.jxw.gk.GkAppUseInfo r0 = com.jxw.gk.GkAppUseInfo.getGkAppUseInfo()     // Catch: java.lang.Exception -> L5f
            java.util.List<com.jxw.gk.AppUseInfo> r0 = r0.datas     // Catch: java.lang.Exception -> L5f
            java.lang.Object r4 = r0.get(r4)     // Catch: java.lang.Exception -> L5f
            com.jxw.gk.AppUseInfo r4 = (com.jxw.gk.AppUseInfo) r4     // Catch: java.lang.Exception -> L5f
            java.lang.Integer r3 = r3.getEnabled()     // Catch: java.lang.Exception -> L5f
            r4.setEnabled(r3)     // Catch: java.lang.Exception -> L5f
            goto L5f
        L5c:
            int r4 = r4 + 1
            goto L1c
        L5f:
            org.greenrobot.eventbus.EventBus r3 = org.greenrobot.eventbus.EventBus.getDefault()
            com.jxw.gk.GkEvent r4 = new com.jxw.gk.GkEvent
            r4.<init>()
            r3.post(r4)
            return
        */
        throw new UnsupportedOperationException("Method not decompiled: com.jxw.gk.ControlAppReceiver.onReceive(android.content.Context, android.content.Intent):void");
    }

    public static void destroy() {
        mContext.unregisterReceiver(mReceiver);
    }
}
